package com.dianning.web.action;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.*;
import com.dianning.bean.Visitor;
import com.dianning.fio.AvatarUploadFile;
import com.dianning.service.VisitorService;

public class Avatar extends BaseAction{

	private static final Log logger = LogFactory.getLog(Avatar.class);

	private AvatarUploadFile avatarUploadFile;

	public AvatarUploadFile getAvatarUploadFile() {
		return avatarUploadFile;
	}

	public void setAvatarUploadFile(AvatarUploadFile avatarUploadFile) {
		this.avatarUploadFile = avatarUploadFile;
	}
	
	private long uid;
	private String rnd;


	public long getUid() {
		return uid;
	}

	public void setUid(long uid) {
		this.uid = uid;
	}
	
	public String getRnd() {
		return rnd;
	}

	public void setRnd(String rnd) {
		this.rnd = rnd;
	}
	
	private String tourl;

	public String getTourl() {
		return tourl;
	}

	public void setTourl(String tourl) {
		this.tourl = tourl;
	}
	
	public String execute() {
		this.setTourl(this.getAvatarUploadFile().findAvatar(this.uid));
		if(StringUtils.isNotBlank(this.rnd)){
			this.setTourl(this.getTourl() + "?time=" + System.currentTimeMillis());
		}
		return SUCCESS;
	}


}
